#include<iostream>
using namespace std;
#include<vector>
class Solution {
public:
    bool canConstruct(string ransomNote, string magazine) {
        int m = ransomNote.size(), n = magazine.size();
        int hash1[26], hash2[26];
        for (int i = 0; i < m; i++)
            hash1[ransomNote[i] - 'a']++;
        for (int i = 0; i < n; i++)
            hash2[magazine[i] - 'a']++;
        for (int i = 0; i < 26; i++)
            if (hash2[i] < hash1[i])return false;

        return true;
    }
};